import { request } from "@/request";

//1.请求购物车列表
export const reqShopCart = () => {
  return request.get(`/api/cart/cartList`);
};

//2.修改单个商品选中状态
export const reqCheckSingle = (skuID, isChecked) => {
  return request.get(`/api/cart/checkCart/${skuID}/${isChecked}`);
};
//3.批量选中购物车
export const reqCheckAll = (isChecked, skuIdList) => {
  return request.post(`/api/cart/batchCheckCart/${isChecked}`, skuIdList);
};
//4.删除某个商品
export const reqDeleteSingle = (skuId) => {
  return request.delete(`/api/cart/deleteCart/${skuId}`);
};
//5.删除选中商品
export const reqDeleteAll = (skuIdList) => {
  return request.post(`/api/cart/batchDeleteCart`, skuIdList);
};
//6.封装加入购物车请求
export const reqChangeCartNum = (skuId, skuNum) => {
  return request.post(`/api/cart/addToCart/${skuId}/${skuNum}`);
};
